package cn.jhc.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.jhc.bean.MusicBean;
import cn.jhc.dao.ConnectionFactory;
import cn.jhc.dao.NewUserDao;

@WebServlet(name = "search Music", urlPatterns = { "/houtai_searchMusic.do" })
public class Houtai_SearchMusicServlet extends HttpServlet {
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		req.setCharacterEncoding("UTF-8");
		String title = (String) req.getParameter("title");
		NewUserDao dao = new NewUserDao();
		dao.setCon(ConnectionFactory.getConnection());
		List<MusicBean> list=dao.SearchMusic(title);
		req.setAttribute("Music", list);
		RequestDispatcher dispatcher = req.getRequestDispatcher("/houtai_deleteyuepu.jsp?search=yes");
		dispatcher.forward(req, resp);
	}
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		doGet(req, resp);
	}
}
